package SuanFa;

import java.util.Scanner;

/**
 * 暂缓
 * 题目：打印出所有的 "水仙花数 "，所谓 "水仙花数 "是指一个三位数，其各位数字立方和等于该数本身。例如：153是一个 "水仙花数 "，因为153=1的三次方＋5的三次方＋3的三次方。
 */
public class Test3 {
    public static void main(String[] args) {
        System.out.println("please input the num");
        Scanner scanner = new Scanner(System.in);
        String num = scanner.nextLine();
        boolean b =num.matches("[0-9]+");
        if (!b){
            System.out.println("wrong format");
        }else {
            double read = Integer.parseInt(num);
            int count =0;
            double numch1 =0;
            for (int i=1;i<=read;i++){
                String snum = String.valueOf(i);
                char[] numch =snum.toCharArray();
                for (int j=0;j<numch.length;j++){
                    double a =Math.pow(1,3);

                    double a1 =Math.pow(10,j);
                    numch1 =+ (Math.pow(((double) numch[j]),3)*Math.pow(10,j));
                }
                if((numch1==read)){
                    System.out.println(read);
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}
